#include <signal.h>
#include <stdio.h>
#include <unistd.h>

void processSIGUSR1 (int signo)  ;
void processSIGUSR2 (int signo)  ;

int main ()
{
    if ( signal(SIGUSR1, processSIGUSR1) == SIG_ERR )
        printf ( "can't catch SIGUSR1.\n" ) ;

    if ( signal(SIGUSR2, processSIGUSR2) == SIG_ERR )
        printf ( "can't catch SIGUSR2.\n" ) ;

    while (1) 
        pause() ;
}

void processSIGUSR1 (int signo)  
{
    if ( signo != SIGUSR1 )
        return ;
    
    printf ( "You can do anything when user send SIGUSR1 in this func\n" ) ;
    printf ( "You can do anything when user send SIGUSR1 in this func\n" ) ;
    printf ( "You can do anything when user send SIGUSR1 in this func\n" ) ;
    printf ( "You can do anything when user send SIGUSR1 in this func\n" ) ;
}

void processSIGUSR2 (int signo)  
{
    if ( signo != SIGUSR2 )
        return ;
    
    printf ( "You can do anything when user send SIGUSR2 in this func\n" ) ;
    printf ( "You can do anything when user send SIGUSR2 in this func\n" ) ;
    printf ( "You can do anything when user send SIGUSR2 in this func\n" ) ;
    printf ( "You can do anything when user send SIGUSR2 in this func\n" ) ;
}
